import { request } from 'umi';

// 退出登陆
export async function outLogin() {
  return request<LoginResponse.BaseResponse>('/api/service/outLogin',{method:"GET"})
}
// 获取服务商
export async function getService(params: Login.QueryService) {
  return request<LoginResponse.ServiceList>('/api/service/my/services',{method:"GET", params})
}
// 服务登陆
export async function serviceLogin(data: Login.ServiceLogin) {
  return request<LoginResponse.ServiceLogin>('/api/service/login',{method:"POST", data})
}

// 用户账号验证
export async function accountCheck(data: Login.CheckAccount) {
  return request<LoginResponse.ResCheckAccount>('/api/service/account/check',{method:"POST", data})
}

/**
 * 获取二维码链接
 * @param params 扫码类型 {scan_type: string;}
 */
 export async function wechat_code(params: Login.WechatCode) {
  return request<LoginResponse.ResQrcode>('/api/wechat/qrcode', { method: "GET", params});
}

/**
 * 查询扫码状态
 * @param params 请求码 {web_code: string;}
 */
export async function check_scan(params: Login.CheckScan) {
  return request<LoginResponse.ResWecatCheck>('/api/wechat/check_scan', { method: "GET", params })
}

/**
 * 服务商注册
 * @param params 
 * web_code: string;
 * service_name: string;
 */
export async function service_reg(data: Login.ServiceReg) {
  return request<LoginResponse.ResRegister>('/api/service/reg', { method: "POST", data });
}

// 获取当前用户信息
export async function currentUser() {
  return request<LoginResponse.CurrentUser>('/api/service/current/user',{method:"GET"})
}


